import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    loginBoxState: false,
    loginTypeState: 1,
    userInfo: null
  },
  mutations: {
    handleLoginBoxChange(state, flag) {
      state.loginBoxState = flag;
    },
    handleLoginTypeChange(state, flag) {
      state.loginTypeState = flag;
    },
    handleUserInfoChange(state, flag) {
      state.userInfo = flag;
    }
  },
  actions: {
    handleLoginBoxChange(context, flag) {
      context.commit('handleLoginBoxChange', flag);
    },
    handleLoginTypeChange(context, flag) {
      context.commit('handleLoginTypeChange', flag);
    },
    handleUserInfoChange(context, flag) {
      context.commit('handleUserInfoChange', flag);
    }
  }
})